package com.xtedu.examproject.service;

import com.xtedu.examproject.dao.base.ExamQuestionRelationDao;
import com.xtedu.examproject.dao.impl.ExamQuestionRelationDaoImpl;
import com.xtedu.examproject.entity.ExamQuestion;
import com.xtedu.examproject.entity.ExamQuestionRelation;

import java.util.List;

/*
 * Author: xzy
 * Date: 2025/10/16
 * Last Modified by: xzy
 * Last Modified date: 2025/10/16
 * Description: TODO - Add file description here
 */
public class ExamQuestionRelaService {
    private final ExamQuestionRelationDao examQuestionRelationDao;

    public ExamQuestionRelaService() {
        examQuestionRelationDao = new ExamQuestionRelationDaoImpl();
    }

    public int insert(ExamQuestionRelation examQuestionRelation) throws Exception {
        return examQuestionRelationDao.insert(examQuestionRelation);
    }

    public int insert(int examId, int questionId) {
        return examQuestionRelationDao.insert(examId, questionId);
    }

    public int update(ExamQuestionRelation examQuestionRelation) throws Exception {
        return examQuestionRelationDao.update(examQuestionRelation);
    }

    public int delete(ExamQuestionRelation examQuestionRelation) throws Exception {
        return examQuestionRelationDao.delete(examQuestionRelation);
    }

    public int deleteById(int id) throws Exception {
        return examQuestionRelationDao.deleteById(id);
    }

    public ExamQuestionRelation findById(int id) throws Exception {
        return examQuestionRelationDao.findById(id);
    }

    public List<ExamQuestion> findByExamId(int examId) throws Exception {
        return examQuestionRelationDao.findByExamId(examId);
    }

    public List<Integer> findEndingExamQuestionIds(List<Integer> questionIds) {
        return examQuestionRelationDao.findEndingExamQuestionIds(questionIds);
    }

    public int[] deleteBatch(List<Integer> questionIds) {
        return examQuestionRelationDao.deleteBatch(questionIds);
    }
}
